<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script src="./scripts/axios.js"></script>
		<script>
			// 传参方式：
			// 1. url 地址后加参数 传参
			// 2. params 传递
			axios.get('http://127.0.0.1:3000/axios?id=2').then((data) => {
				const { data: res } = data
				console.log(res)
			})

			axios.get('http://127.0.0.1:3000/axios/4').then((data) => {
				const { data: res } = data
				console.log(res)
			})

			axios
				.get('http://127.0.0.1:3000/axios', {
					params: {
						id: 6
					}
				})
				.then((data) => {
					const { data: res } = data
					console.log(res)
				})
			axios
				.delete('http://127.0.0.1:3000/axios', {
					params: {
						id: 6
					}
				})
				.then((data) => {
					const { data: res } = data
					console.log(res)
				})
		</script>
	</body>
</html>
